package zsc.liangyi.blog.service;

import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;

@Service
public class TaskService {
    @Autowired
    private RabbitTemplate rabbitTemplate;
//    cron="秒 分 时 日 月 星期x"，每晚八点发消息
    @Scheduled(cron = "0 0 20 * * *")
    public void scheduledSendEmail(){
        rabbitTemplate.convertAndSend("topic_exchange","info.email","发送博客热门排行");
    }
}
